+2005-11-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Ignore
+ icons if they would make the request large enough to cause
+ Xlib to loose the connection. (#320909, Claudio Saavedra)
+
2005-11-08 Michael Natterer <mitch@imendio.com>
* gdk/gdk.symbols
+2005-11-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Ignore
+ icons if they would make the request large enough to cause
+ Xlib to loose the connection. (#320909, Claudio Saavedra)
+
2005-11-08 Michael Natterer <mitch@imendio.com>
* gdk/gdk.symbols
toplevel->user_time = timestamp_long;
}
+#define GDK_SELECTION_MAX_SIZE(display) \
+ MIN(262144, \
+ XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) == 0 \
+ ? XMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100 \
+ : XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100)
+
/**
* gdk_window_set_icon_list:
* @window: The #GdkWindow toplevel window to set the icon of.
gint x, y;
gint n_channels;
GdkDisplay *display;
+ gint n;
g_return_if_fail (GDK_IS_WINDOW (window));
l = pixbufs;
size = 0;
-
+ n = 0;
while (l)
{
pixbuf = l->data;
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
+ /* silently ignore overlarge icons */
+ if (size + 2 + width * height > GDK_SELECTION_MAX_SIZE(display))
+ {
+ g_warning ("gdk_window_set_icon_list: icons too large");
+ break;
+ }
+
+ n++;
size += 2 + width * height;
-
+
l = g_list_next (l);
}
l = pixbufs;
p = data;
- while (l)
+ while (l && n > 0)
{
pixbuf = l->data;
}
l = g_list_next (l);
+ n--;
}
if (size > 0)